import React, {PureComponent} from "react";
import PropTypes from 'prop-types';
import {Provider} from "react-redux";
import routes from "../routes";
import {Router} from "react-router";


(function(doc, win) {
  var docEl = doc.documentElement,
      resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
      recalc = function() {
          var clientWidth = docEl.clientWidth;
          if (!clientWidth) return;
          docEl.style.fontSize = 100 * (clientWidth / 375) + 'px';
      };
  if (!doc.addEventListener) return;
  win.addEventListener(resizeEvt, recalc, false);
  doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);


export default class extends PureComponent {
  static propTypes = {
    store: PropTypes.object.isRequired,
    history: PropTypes.object.isRequired
  }

  render() {
    const {store, history} = this.props
    return <Provider  store={store}>
      <Router  history={history} routes={routes}/>
      </Provider>
  }
}
